package com.sample.navigation.fragment;

import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.sample.navigation.MainActivity;
import com.sample.navigation.R;
import com.sample.navigation.fragment.dialog.FragmentDialogBottom;
import androidx.fragment.app.Fragment;


public class Fragment2 extends Fragment {
    private View rootView;
    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        rootView = inflater.inflate(R.layout.fragment_2, null);
        initComponents();
        return rootView;
    }

    private void initComponents(){
        FragmentDialogBottom dialogBottom = new FragmentDialogBottom(this);
        rootView.findViewById(R.id.select_education)
                .setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        dialogBottom.show(getChildFragmentManager(), FragmentDialogBottom.class.getSimpleName());
                        //此处设置为true表示点击灰色区域退出
                        //如果不需要点击灰色区域退出请设置为false
                        dialogBottom.setCancelable(false);
                    }
                });
    }

    public void switchToNext(){
        ((MainActivity)getActivity()).switchToNext(2);
    }
}
